package com.study.demo.aop.demo4;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.UUID;

/**
 * @author: elvin
 * @time: 2019-08-15 10:03
 * @desc:
 **/
@Transactional
//@Repository
public class UserMapper {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public void add() {
        String sql = "INSERT INTO `tbl_user`(name,time) VALUES(?,?)";
        String name = UUID.randomUUID().toString().replace("-", "");
        jdbcTemplate.update(sql, name, System.currentTimeMillis());
        System.out.println("插入方法执行完成");

        int a =  1 / 0;
    }
}
